﻿@model Web.Models.MovieListViewModel

@{
    ViewBag.Title = "Movies";
    Layout = "~/Views/Shared/WorkerLayout.cshtml";
}

<h2>Filmy dostępne w wypożyczalni</h2>

@Html.ActionLink("Dodaj nowy film", "MovieAdd")

@*@Html.ActionLink("Małe ikony", "Movies",ListItemType.Small,Model.PagingInfo.CurrentPage) @Html.ActionLink("Duże ikony", "Movies", ListItemType.Big, Model.PagingInfo.CurrentPage)
*@

@if (Model != null)
    {
        if (Model.Size == MovieListViewModel.SizeBig)
        {
            foreach (Web.Models.MovieViewModel movie in Model.movies)
            {
                 <div class="listItemBig">
                    
                </div>
            }
        }
        else
        {
            <table class="list">
                <thead>
                    <tr>
                        <td>Tytuł</td>
                        <td>Reżyser</td>
                        <td>Wydawca</td>
                        <td>Data wydania</td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                </thead>

            @foreach (Web.Models.MovieViewModel movie in Model.movies)
            {
                 <tr>
                    <td>@movie.Movie.MovieTitle</td>
                    <td>@movie.Movie.MovieDirector</td>
                    <td>@movie.Movie.MoviePublisher</td>
                    <td>@movie.Movie.MovieIssueDate.ToString("MMM yyyy")</td>
                    <td>@Html.ActionLink("Edytuj", "MovieEdit", new { guid = movie.Movie.MovieGuid })</td>
                    <td>@Html.ActionLink("Usuń", "MovieDelete", new { guid = movie.Movie.MovieGuid })</td>
                    <td>@Html.ActionLink("Nośniki", "MovieCopies", new { guid = movie.Movie.MovieGuid })</td>
                 </tr>
            }

            </table>
        }
    }
    
    <div class="pagesNavigation">
        @Html.PageLinks(Model.PagingInfo, x => Url.Action("Movies", new { page = x }))
    </div>